package demo.ClassLoad;

import java.lang.reflect.Method;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/8/5-08-05-14:37
 * @Description：demo.ClassLoad      反射操作方法
 */
public class reflect_useMethod {
    public static void main(String[] args) throws Exception {
        //操作方法
        Class c = Class.forName("demo.ClassLoad.Student");
        Object o = c.newInstance();

        Method sayHello = c.getMethod("sayHello");
        sayHello.setAccessible(true);

        System.out.println(sayHello.invoke(o));
    }
}
